!
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Navigation Api tutorial
Description: In this tutorial we will explain how to work with ros navigation apiKeywords: ric_nav, ric_navigation, ric nav, ric navigation
Tutorial Level: INTERMEDIATE
Setup
This line includes the action specification for move_base which is a ROS action that exposes a high level interface to the navigation stack. Essentially, the move_base action accepts goals from clients and attempts to move the robot to the specified position/orientation in the world. For a detailed discussion of ROS actions see the
Constructs an action client
This line constructs an action client that we'll use to communicate with the action named "move_base" that adheres to the MoveBaseAction interface. Also we starting up a node call ‘simple navigation goals’, and in the end for this piece for code we wait for the action server to start.
Constructing goals
Here we create a goal to send to move_base using the move_base_msgs::MoveBaseGoal message type which is included automatically with the MoveBaseAction.h header. We'll just tell the base to move 1 meter forward in the "komodo_1/base_link" coordinate frame. The call to move_base_client.send_goal will actually push the goal out over the wire to the move_base node for processing.
The only thing left to do now is to wait for the goal to finish using the move_base_client.wait_for_result call which will block until the move_base action is done processing the goal we sent it. After it finishes, we can check if the goal succeded or failed and output a message to the user accordingly.